from game import *

class Debugger(object):

	def __init__(self, game, active):
		self.game = game
		self.active = active
		self.temp = []
		self.perm = []
		self.font = pygame.font.Font(globals.fonts['pixel'], 10)
		
	def log(self, statement):
		if not self.active: return
		self.temp.append((statement, (255,255,255)))
		
	def enable(self):
		self.active = True
		
	def disable(self):
		self.active = False
		
	def draw(self):
		if not self.active: return
		
		h = self.font.get_height()
		x = h
		y = h
		statements = self.perm + self.temp
		for dbg in statements:
			txt = self.font.render(dbg[0], True, dbg[1])
			self.game.screen.blit(txt, (x, y))
			y += h
			
		self.temp = []
